package org.example.service.impl;

import org.example.entity.Students;
import org.example.mapper.StudentsMapper;
import org.example.service.IStudentsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author
 * @since 2024-06-19
 */
@Service
public class StudentsServiceImpl extends ServiceImpl<StudentsMapper, Students> implements IStudentsService {
    @Autowired
    StudentsMapper studentsMapper;

    @Override
    public Map<String, Object> listByReq(Map<String, String> req) {
        Map<String, Object> map1 = new HashMap<>();
        map1.put("a1", Integer.valueOf((Integer.valueOf(req.get("currentPage4")) - 1) * Integer.valueOf(req.get("pageSize"))));
        map1.put("a2", Integer.valueOf(req.get("pageSize")));
        System.out.println("req==========>" + map1);
        List<Students> list = studentsMapper.listByReq(map1);
        int count = studentsMapper.listByReqCount(map1);
        Map<String, Object> map2 = new HashMap<>();
        map2.put("total", count);
        map2.put("rows", list);
        return map2;
    }
}
